/// @description Insert description here
// You can write your code in this editor
var temp_joystick = 0;

if( device_mouse_check_button(temp_joystick,mb_left))
{
	var temp_dir = point_direction(x,y,device_mouse_x(temp_joystick),device_mouse_y(temp_joystick))
	if (point_distance(x,y,device_mouse_x(temp_joystick),device_mouse_y(temp_joystick))<30*var_screen_size )
	{
		var_joystick_active = true;
		var_x_dir = lerp(var_x_dir,device_mouse_x(temp_joystick)- x,0.15) ;
		var_y_dir = lerp(var_y_dir,device_mouse_y(temp_joystick)- y,0.15) ;
		move(0.02);
	}
		if (point_distance(x,y,device_mouse_x(temp_joystick),device_mouse_y(temp_joystick))>30*var_screen_size && point_distance(x,y,device_mouse_x(temp_joystick),device_mouse_y(temp_joystick))<60*var_screen_size)
	{
		var_joystick_active = true;
		var_x_dir = lerp(var_x_dir,device_mouse_x(temp_joystick)- x,0.15) ;
		var_y_dir = lerp(var_y_dir,device_mouse_y(temp_joystick)- y,0.15) ;
		move(0.7);
	}
	if (var_joystick_active = true && (point_distance(x,y,device_mouse_x(0),device_mouse_y(0))>60*var_screen_size))
	{
		var_x_dir = lengthdir_x(60*var_screen_size,temp_dir);
		var_y_dir =  lengthdir_y(60*var_screen_size,temp_dir);
		move(1.1);
	}
	
	if o_Hero.y > room_height && o_Hero.y < 0 && o_Hero.x > room_width && o_Hero.x < 0
			{
				var_joystick_active = false;
			}
}
else 
{
	var_joystick_active = false;
	var_x_dir = 0;
	var_y_dir = 0;
	
}
if (var_joystick_active == false) 
{
	with(o_Hero)
{
	speed = 0;
}
}


x = x_cam;
y = y_cam;



